/**
 * 获取房型定价数据
 */
define(function (require, exports, module) {
    var aw = require("ajaxwrapper");
    var moment = require("moment");

    module.exports = {
    	getRoomTypesData:function(pkServicePoint,pkOrgBuilding,pkRoomType,saleDate,callback){
    		var servicePoint = pkServicePoint;
    		var orgBuilding = pkOrgBuilding;
    		var roomType = pkRoomType;
    		var saleDateStart = moment(saleDate).startOf('month');
    		var saleDateEnd = moment(saleDate).endOf('month');
    		
    		aw.ajax({
				url:"api/roomtypeprice/query",
				data:{
					servicePoint:servicePoint,
					orgBuilding:orgBuilding,
					roomType:roomType,
					saleDate:saleDateStart.format("x"),
					saleDateEnd:saleDateEnd.format("x"),
					fetchProperties:"*",
				},
				dataType:"json",
				success:function(data){
					callback(data);
				}
			});
    	},
    	getOrgBuilding:function(pkServicePoint,callback){
    		aw.ajax({
				url:"api/orgbuilding/query",
				data:{
					"servicePoint.pkServicePoint":pkServicePoint
				},
				dataType:"json",
				success:function(data){
					callback(data);
				}
			});
    	},
    	getRoomtype:function(pkServicePoint,pkOrgbuilding,callback){
    		aw.ajax({
				url:"api/groupreserve/queryroomtype",
				data:{
					"orgBuilding":pkOrgbuilding
				},
				success:function(data){
					callback(data);
				}
			});
    	},
    	save:function(data,callback){
    		aw.saveOrUpdate("api/roomtypeprice/deleteandsave",data,function(data){
    			callback(data);
			});
    	}
    };
});
